class Lyrics
  include HTTParty
  base_uri 'lyrics.wikia.com'
  
  def initialize(artist, song)
    @artist = artist.to_s.tr(' ', '_')
	@song = song.to_s.tr(' ', '_')
	@lyrics = self.class.get("/api.php?func=getSong&artist=#{@artist}&song=#{@song}&fmt=text")
	@url = "http://lyrics.wikia.com/#{@artist}:#{@song}"
  end
  
  #Returns true if lyrics were found
  def lyrics_found?
    @lyrics != "Not found"
  end
  
  #Returns the lyrics that were found with the API
  def lyrics
    @lyrics
  end
  
  #Returns the URL for the full lyrics
  def url
    @url
  end
  
  #
  #
  def self.get_lyrics(artist, song)
    a = artist.to_s.tr(' ', '_')
	s = song.to_s.tr(' ', '_')
    get("/api.php?func=getSong&artist=#{a}&song=#{s}&fmt=text")
  end

end
